<style lang="scss" scoped>
.center {
	padding-top: R(40px);
	padding-bottom: R(100px);
}
.mycenter-header {
	background: $themeColor url(../../common/images/newIcon/bg-common.png) no-repeat;
	background-size: 100% auto;
	padding: R(20px) 0;
	display: flex;
	align-items: center;
	position: relative;
	height: R(200px);
	padding-left: R(46);
	margin: 0 R(25);
}

.mycenter-header .myuserimage {
	width: R(90px);
	height: R(90px);
	padding-right: R(25);
}
.myuserimage {
	// margin: 0 auto;
}

.mycenter-header .myuserinfor {
	justify-content: center;
	.level-icon {
		display: flex;
		align-items: center;
		color: #fff;
		.icon {
			width: 25px;
			height: 25px;
			margin-right: 5px;
		}
	}
	.level-str {
		font-size: 0.25rem;
		white-space: nowrap;
	}
}

.mycenter-header .myuserinfor .tit {
	font-size: 0.32rem;
	color: #fff;
}

.mycenter-header .myuserinfor .num {
	font-size: 0.28rem;
	color: #fff;
}
.my-user-info {
	color: #000;
	// text-align: center;
}

.my-user-info-name {
	font-size: R(32px);
	font-family: PingFang SC;
	font-weight: 500;
	color: #ffffff;
	text-align: center;
}

.my-user-info-code {
	padding-bottom: 10px;
	font-size: R(26px);
	font-family: Source Han Sans CN;
	font-weight: 500;
	color: #ffffff;
}
.my-user-info-btn {
	width: 2.17rem;
	height: 0.67rem;
	line-height: 0.67rem;
	color: #fff;
	background-color: #ffd300;
	// border: 1px solid #f08940;
	margin-left: auto;
	border-radius: 0.5rem 0 0 0.5rem;
}
.my-user-info-btn-content {
	display: -webkit-box;
	display: -webkit-flex;
	display: flex;
	-webkit-box-align: center;
	-webkit-align-items: center;
	align-items: center;
	-webkit-box-pack: center;
	-webkit-justify-content: center;
	justify-content: center;
	white-space: nowrap;
	height: 100%;
}
.level-box {
	position: absolute;
	bottom: -0.9rem;
	width: 6.89rem;
	height: 1.63rem;
	background: #ffffff;
	border-radius: R(4px);
	left: 50%;
	transform: translateX(-50%);
	.level-box-container {
		margin-top: 0.22rem;
		padding: 0 0.38rem;
		position: relative;
		.icon-box-content {
			position: absolute;
			// width: 100%;
			width: 6.2rem;
			.level-icon {
				display: flex;
				justify-content: space-between;
				position: relative;
				z-index: 1;
				.level {
					text-align: center;
					image {
						width: R(70px);
						height: R(77px);
						object-fit: cover;
					}
					p {
						font-size: 0.28rem;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #434343;
					}
				}
			}
			.level-slider {
				position: relative;
				top: -0.3rem;
				z-index: 0;
				padding: 0 0.38rem;
				left: 0;
			}
		}
	}
	.upgrade-tip {
		height: 0.54rem;
		line-height: 0.54rem;
		background: rgba(255, 255, 255, 0.1);
		border-radius: 0.24rem;
		text-align: center;
		color: #535353;
		margin: auto auto 0.23rem;
		font-size: 0.29rem;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		.toDetail {
			width: 2.29rem;
			display: inline-block;
			height: 0.5rem;
			margin-left: 0.2rem;
			line-height: 0.5rem;
			text-align: center;
			background: #d7eef8;
			border-radius: 0.3rem;
			color: $themeColor;
		}
	}
}

.my_section {
	margin: R(0px) R(20px) 0;
	// box-shadow: 0 0 0.1rem rgba(0, 0, 0, 0.1);
	background: #fff;
	border-radius: R(4px);
}
.setMargin {
	margin: R(20px) R(20px) 0;
}
.my_section .my-cate .my-cate-item {
	position: relative;
	.list-icon {
		width: R(80px);
		height: R(80px);
		margin-right: R(25px);
	}
}
.my-cate .clearfix {
	background: #f4f4f4;
}

// .my_section .my-cate .my-cate-item:after {
// 	content: '';
// 	position: absolute;
// 	display: block;
// 	background: #ddd;
// 	pointer-events: none;
// 	z-index: 1;
// 	height: 1px;
// 	left: 0;
// 	right: 0;
// 	bottom: 0;
// }

.my_section .my-cate li {
	display: flex;
	padding: R(15px);
	min-height: R(120px);
	align-items: center;
	margin-bottom: R(12);
	background: #fff;
}

.my_section .my-cate .iconfont {
	display: flex;
	font-size: 0.45rem;
	margin-right: 0.15rem;
}

.my_section .my-cate .iconfont.icon-Downarrow-R {
	margin-right: 0;
	font-size: R(35);
	color: silver;
}
.icon-banbengengxin {
	color: #5e64f4;
}
.my_section .my-cate .iconfont.bluecl {
	color: #2599f7;
}

.my_section .my-cate .iconfont.yellowcl {
	color: #ffd300;
}

.my_section .my-cate .iconfont.redcl {
	color: #ff3030;
}

.my_section .my-cate .txt {
	flex: 1;
}
/deep/.van-slider--disabled {
	opacity: 1;
}
.contact {
	display: flex;
	padding: 0 R(15);
	min-height: 100rpx;
	align-items: center;
	background: #fff;
	border-bottom: 1px solid #eee;
	.txt {
		flex: 1;
		font-size: R(26);
		text-align: left;
	}
}
.data-box {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	display: flex;
	border-top: 1px solid #eee;
	.item {
		display: flex;
		color: #fff;
		width: 50%;
		padding: R(20) 0;
		justify-content: center;
		align-items: center;
		.data {
			display: flex;
			flex-direction: column;
			text-align: center;
			span:nth-child(1) {
				color: #f1f1f1;
				font-size: R(24);
			}
			span:nth-child(2) {
				font-size: R(33);
				margin: R(10) 0;
			}
			span:nth-child(3) {
				width: R(120);
				height: R(35);
				line-height: R(35);
				text-align: center;
				border-radius: R(30);
				border: 1px solid #fff;
			}
		}
		.icon-Downarrow-R {
			font-size: R(42);
		}
	}
}
.line {
	border-right: 1px solid #eee;
}
</style>
<template>
	<div class="center mycenter-wrap mescroll-touch mescroll-touch-y">
		<view class="top-title">
			<text class="title-name">钱包</text>
			<text class="withdrawal-info" @click="withdrawalInfoHandel">提现记录</text>
		</view>
		<div class="mycenter-header">
			<div class="myuserimage"><image :src="require('@/common/images/user-icon.png')" /></div>
			<div class="myuserinfor flex" @click.stop="toDetail">
				<div class="my-user-info-name">{{ user.agentName ? user.agentName : '' }}({{ user.agentNo }})</div>
				<!-- <div class="my-user-info">
          <div class="my-user-info-code">推荐码：{{ user.invitationCode }}</div>
        </div> -->
			</div>
			<!-- <div class="level-box flex-column">
        <div class="level-box-container">
          <div class="icon-box-content">
            <div class="level-icon">
              <div
                class="level"
                v-for="(item, index) in levelList"
                :key="index"
              >
                <p :class="{ active: userIndex == index }">{{ item.name?item.name:'-' }}</p>
                <image
                  class="animate__animated animate__bounceIn"
                  :src="item.image"
                  alt
                  @click.stop="toDetail"
                />
              </div>
            </div>
            <div class="level-slider">
              <van-slider disabled bar-height="0.07rem" v-model="value">
                <template #button>
                  <div class="custom-button"></div>
                </template>
              </van-slider>
            </div>
          </div>
        </div>
    
      </div> -->
		</div>

		<div class="my_section setMargin">
			<div class="my-cate">
				<ul class="clearfix">
					<li class="my-cate-item" v-for="(item, index) in list" :key="index" @click="itemHandle(item)" v-if="!$store.state.user.isSpecificAccount || !item.isSpecificAccount">
						<image :src="item.icon" class="list-icon" />
						<p class="txt">{{ item.text }}</p>
						<div class="arrow-r"><i class="iconfont icon-Downarrow-R iconfont-right"></i></div>
					</li>
				</ul>
			</div>
		</div>
		<view class="my_section">
			<view class="my-cate">
				<ul class="clearfix">
					<!-- #ifdef MP-WEIXIN -->
					<button open-type="contact" class="my-cate-item contact">
						<image :src="require('@/common/images/newIcon/my-list-icon4.png')" class="list-icon" />

						<p class="txt">联系客服</p>
						<view class="arrow-r"><i class="iconfont icon-Downarrow-R iconfont-right"></i></view>
					</button>
					<!-- #endif -->
					<!-- <li class="my-cate-item" @click.stop="toupdatePassword">
            <image
              :src="require('@/common/images/newIcon/my-list-icon6.png')"
              class="list-icon"
            />

            <p class="txt">修改密码</p>
            <view class="arrow-r"
              ><i class="iconfont icon-Downarrow-R iconfont-right"></i
            ></view>
          </li> -->
					<li class="my-cate-item" @click="logoutHandle">
						<image :src="require('@/common/images/newIcon/my-list-icon6.png')" class="list-icon" />

						<p class="txt">退出登录</p>
						<view class="arrow-r"><i class="iconfont icon-Downarrow-R iconfont-right"></i></view>
					</li>
				</ul>
			</view>
		</view>
		<m-s-footer :tabIdx="1" v-if="$store.state.user.isSpecificAccount"></m-s-footer>
		<m-footer :tabIdx="3" v-else></m-footer>
	</div>
</template>

<script>
import { getSysParam } from '_a/sms';
export default {
	name: 'MyInfo',
	data() {
		return {
			invitationCode: '',
			list: [
				{
					text: '基本资料',
					routerLink: '/pages/myInfo/baseInfo/index',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon1.png'),
					isCert: true,
					clickType: 'router'
				},
				{
					text: '修改密码',
					routerLink: '/pages/myInfo/updatePassword/index',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon2.png'),
					isCert: true,
					clickType: 'router'
				},
				{
					text: '我的结算卡',
					routerLink: '/pages/myInfo/settlementAccount/index',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon3.png'),
					isCert: true,
					settle: true,
					clickType: 'router',
					isSpecificAccount: true
				},
				{
					text: '隐私政策',
					routerLink: '/pages/login/agreement/index',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon7.png'),
					clickType: 'router'
				},
				
				{
					text: '用户协议',
					routerLink: '/pages/login/agreement/index?type=2',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon8.png'),
					clickType: 'router'
				}
,
				
				{
					text: '邀请注册',
					routerLink: '/pages/home/invitation/index',
					routerType: 'path',
					icon: require('@/common/images/newIcon/my-list-icon8.png'),
					clickType: 'router'
				}
				// {
				//   text: "收货地址",
				//   routerLink: "userAddress",
				//   routerType: "name",
				//   icon: require("@/common/images/newIcon/my-list-icon3.png"),
				//   isCert: false,
				//   clickType: "router",
				// },
				// {
				//   text: "联系我们",
				//   routerLink: "",
				//   routerType: "",
				//   icon: require("@/common/images/newIcon/my-list-icon4.png"),
				//   isCert: false,
				//   clickType: "click",
				// },
			],
			value: 50,
			userIndex: 1
		};
	},
	computed: {
		user() {
			return this.$store.getters.user || {};
		},
		awardInfo() {
			return this.$store.getters.userInfo.wallet || {};
		}
	},
	mounted() {},
	async created() {
		uni.hideTabBar({});
		// this.user = this.$store.getters.user;
	},
	// 下拉刷新
	async onPullDownRefresh() {
		this.$store.dispatch('getUserDetail').then(res => {
			uni.stopPullDownRefresh();
			this.$tip.toast('刷新成功!', 'success', 500);
		});
	},
	methods: {
		toList() {
			this.$nav.push({
				path: '/pages/home/lottery/list'
			});
		},
		navPage(router) {
			this.$nav.push(router);
		},
		earningsWithdrawalHandle(type) {
			const routeName = '/pages/earnings/earningsWithdrawal';
			this.$nav.push({
				path: routeName,
				query: {
					type: type
				}
			});
		},
		// 下拉刷新
		downRefresh() {
			this.downBackMixin(this.agentInfoHandle);
		},
		toCertification() {
			this.$nav.push({ path: 'certification' });
		},
		toDetail() {
			// this.$nav.push({ path: "/tuiKeGrade" });
			// return this.$toast('敬请期待!')
		},
		toupdatePassword() {
			this.$nav.push({ path: '/pages/myInfo/updatePassword/index' });
		},
		logoutHandle() {
			this.$tip.modal({ content: '是否退出登录?' }).then(res => {
				console.log(res);
				this.$store.dispatch('StoreByLogout').then(res => {
					this.$nav.reLaunch({ path: '/pages/login/index' });
				});
			});
		},
		itemHandle(item) {
			const routeName = item.routerLink;
			// 实名绑卡检查
			if (item.settle) {
				if (this.user.realStatus == 0) {
					this.$tip.modal({ content: '未绑卡,前往绑卡!', showCancel: false }).then(res => {
						this.$nav.push({
							path: '/pages/myInfo/bindCard/bindCard',
							query: {
								type: 'add'
							}
						});
					});
				} else {
					this.$nav.push({ path: routeName });
				}
			} else {
				this.$nav.push({ path: routeName });
			}
		}
	}
};
</script>
